<?php
//http://www.cnblogs.com/mitang/p/3537757.html
//道驰路由选择
//测试方法：
//http://localhost/phplearn/mysql/callSqlFunctionDaochi.php?package=YD01&userid='386'&phonenum=13964637019&operator='1'


$package  = $_GET['package']  ;
$puserid  = $_GET['userid'];
$pphonenum =$_GET['phonenum'];		
$poperator =$_GET['operator'];


$mysql = "SELECT `renderRoute`('$puserid' ,$pphonenum,'$package',$poperator) ; " ;
echo   $mysql."\n\r";
$rec =  do_query($mysql) ;
print_r($rec);
$row = $rec->fetch_assoc ();
print_r($row);
$array = array_values($row);
 var_dump($array);
 

function do_query($str) {
	require (dirname ( __FILE__ ) . '/config.php');
	//   	$connection = mysqli_connect ( $db_host, $db_user, $db_pass, $db_name ) or die ( "Unable to connect!" );
	//$connection = mysqli_connect ( 'localhost:3308', 'root', 'jinga', 'myflow' ) or die ( "Unable to connect!" );
	//$connection = mysqli_connect ( explode(":",$db_host)[1], $db_user, $db_pass, $db_name,explode(":",$db_host)[2] )or die ( "Unable to connect!" );
	//$connection = mysqli_connect ( 'localhost', $db_user, $db_pass, $db_name,'3308' )or die ( "Unable to connect!" );
	$connection = mysqli_connect ( $db_host, $db_user, $db_pass, $db_name  )or die ( "Unable to connect!" );
	mysqli_query($connection,'set names utf8');
	$result = mysqli_query ( $connection, $str ) or die ( "Error in do_query : " . mysql_error () );

	return $result;
}
